package com.seocoo.worker.base.http;

import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.seocoo.worker.WorkerAppContent;
import com.sfh.lib.AppCacheManager;


public class BaseRsp<T> {

    private String code;

    private String msg;

    @Nullable
    private T data;

    public boolean success() {

        if (TextUtils.equals("200", this.code)) {
            return true;
        }
        if (TextUtils.equals("401", this.code)) {
            WorkerAppContent appContent = (WorkerAppContent) AppCacheManager.getApplication();
            appContent.onExit();
            return false;
        }
        return false;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Nullable
    public T getData() {
        return data;
    }

    public void setData(@Nullable T data) {
        this.data = data;
    }
}
